package group.systemdesign.Mapper;

import group.systemdesign.Pojo.Video;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

import java.util.List;

@Mapper
public interface VideoMapper {
    @Select("SELECT * from video where category='音乐' order by likes desc")
    List<Video>likesMusic();
    @Select("SELECT * from video where category='游戏' order by likes desc")
    List<Video>likesGame();
    @Select("SELECT * from video where category='动漫'order by likes desc")
    List<Video>likesComic();
    @Select("SELECT * from video where category='体育'order by likes desc")
    List<Video>likesSports();
    @Select("SELECT * from video where category='音乐'order by views desc")
    List<Video>viewsMusic();
    @Select("SELECT * from video where category='游戏'order by views desc")
    List<Video>viewsGame();
    @Select("SELECT * from video where category='动漫'order by views desc")
    List<Video>viewsComic();
    @Select("SELECT * from video where category='体育'order by views desc")
    List<Video>viewsSports();
    @Select("SELECT * from video order by likes desc")
    List<Video>likesRecommend();
    @Select("SELECT * from video order by views desc")
    List<Video>viewsRecommend();
    @Select("SELECT * FROM video WHERE video_name LIKE CONCAT('%', #{video_name}, '%')")
    List<Video>searchByName(String video_name);
    @Select("SELECT * FROM video WHERE video_id=#{id}")
    Video addHistory(Integer id);
    @Select("SELECT * FROM video WHERE video_id=#{id}")
    Video addCollection(Integer id);
}
